<template>
  <div class="indicator">
    <el-container>
      <el-input
        style="width: 20%"
        placeholder="预约档案号/姓名"
        v-model="parameter.content"
        clearable
      ></el-input>
      <el-button
        type="primary"
        size="mini"
        @click="onSubmit"
        icon="el-icon-search"
        round
        >查询</el-button
      >
    </el-container>
    <el-table style="width: 100%" align="center"
      v-loading="loading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
     :data="AllUser">
      <el-table-column label="预约档案号" prop="tfollowtmerber" width="120">
      </el-table-column>
      <el-table-column label="姓名" prop="tfollowname" width="100">
      </el-table-column>
      <el-table-column label="回访日期" prop="tFollowdate" width="100">
        <template slot-scope="scope">
          <el-popover trigger="hover" placement="top">
            <p>回访日期:{{scope.row.tFollowdate}}</p>
              <div slot="reference" class="name-wrapper">
                  <el-tag size="medium">{{ scope.row.tFollowdate }}</el-tag>
              </div>
          </el-popover>
        </template>
      </el-table-column>
      <el-table-column label="回访人员" prop="tfollowconfirmcaller" width="100">
        <!-- <template slot-scope="scope">
          <span v-if="scope.row.tfollowconfirmcaller == null"> 初始化跟随</span>
          <span v-if="scope.row.tfollowconfirmcaller != null">
            {{ scope.row.tfollowconfirmcaller }}</span
          >
        </template> -->
      </el-table-column>
      <el-table-column label="方式" prop="tmanner" width="100">
        <!-- <template slot-scope="scope">
          <span v-if="scope.row.tmanner == null"> 初始化跟随</span>
          <span v-if="scope.row.tmanner != null"> {{ scope.row.tmanner }}</span>
        </template> -->
      </el-table-column>
      <el-table-column label="回访内容" prop="tfollowcontent" width="100">
        <template slot-scope="scope">
          <el-popover trigger="hover" placement="top">
              <p>回访内容:{{ scope.row.tfollowcontent }}</p>
                <div slot="reference" class="name-wrapper">
                    <el-tag size="medium">{{ scope.row.tfollowcontent }}</el-tag>
                </div>
            </el-popover>
        </template>
        <!-- <template slot-scope="scope">
          <span v-if="scope.row.tfollowcontent == null"> 初始化跟随</span>
          <span v-if="scope.row.tfollowcontent != null">
            {{ scope.row.tfollowcontent }}</span
          >
        </template> -->
      </el-table-column>
      <el-table-column label="反馈信息" prop="tfollowfeedback" width="100">
        <template slot-scope="scope">
          <el-popover trigger="hover" placement="top">
              <p>反馈信息:{{ scope.row.tfollowfeedback }}</p>
                <div slot="reference" class="name-wrapper">
                    <el-tag size="medium">{{ scope.row.tfollowfeedback }}</el-tag>
                </div>
            </el-popover>
        </template>
        <!-- <template slot-scope="scope">
          <span v-if="scope.row.tfollowfeedback == null"> 初始化跟随</span>
          <span v-if="scope.row.tfollowfeedback != null">
            {{ scope.row.tfollowfeedback }}</span
          >
        </template> -->
      </el-table-column>
      <el-table-column label="处理结果" prop="tresult" width="100">
        <template slot-scope="scope">
          <span v-if="scope.row.tresult == 0"> 未痊愈 </span>
          <span v-if="scope.row.tresult == 1"> 痊愈 </span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="350">
        <template slot-scope="scope">
          <el-button
            type="danger"
            size="mini"
            @click.native="chadetail(scope.row)"
            icon="el-icon-more"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      :total="total"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="parameter.page"
      :page-sizes="[2, 5, 10, 20]"
      :pager-count="9"
      background
      :page-size.sync="parameter.num"
      layout="total, sizes, prev, pager, next, jumper"
    >
    </el-pagination>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
       loading:true,
      parameter: {
        page: 1,
        num: 5,
        content: "",
      },
      AllUser: [],
      total: 0,
    };
  },
  methods: {
      chadetail(){},
    onSubmit() {
      this.load();
    },
    handleSizeChange() {
      this.load();
    },
    handleCurrentChange() {
      this.load();
    },
    load() {
       axios
        .get(
          "/api/TRoleAllList?name=" +
            JSON.parse(sessionStorage.getItem("user")).username
        )
        .then((res) => {
          if (res.data.name == "系统管理员") {
              axios
        .post("/api/lqHealth/selectAllTfollwBytfinsh", this.parameter)
        .then((res) => {
          this.AllUser = res.data.list;
          this.parameter.page = res.data.pageNum;
          this.parameter.num = res.data.pageSize;
          this.total = res.data.total;

          //加载样式
        setTimeout(() => {
          this.loading=false;
        }, 1000);
        });
          } else {
                   axios.post("/api/lqHealth/selectThByname",{name: JSON.parse(sessionStorage.getItem("user")).username}).then(rp=>{
             this.parameter.janID=rp.data.healthMgrId
             console.log(this.parameter)
            axios
              .post("/api/lqHealth/selectAllTFollow2", this.parameter)
              .then((res) => {
                console.log(res);
              this.AllUser = res.data.list;
          this.parameter.page = res.data.pageNum;
          this.parameter.num = res.data.pageSize;
          this.total = res.data.total;
                //加载样式
                setTimeout(() => {
                  this.loading = false;
                }, 1000);
              });
            })



          }
        });
    },
  },
  created() {
    this.load();
  },
};
</script>

<style scoped>
</style>